package com.yeskery.boot.log.record.starter.proxy;

import com.yeskery.boot.log.record.starter.annotation.LogRecord;
import org.springframework.aop.support.StaticMethodMatcherPointcut;
import org.springframework.lang.NonNull;

import java.io.Serializable;
import java.lang.reflect.Method;

/**
 * 日志记录切点
 * @author dushuangjiang
 * @date 2021-11-11 18:05
 */
public class LogRecordPointcut extends StaticMethodMatcherPointcut implements Serializable {
    private static final long serialVersionUID = 1689885841070026812L;

    @Override
    public boolean matches(@NonNull Method method, @NonNull Class<?> targetClass) {
        return method.getAnnotation(LogRecord.class) != null;
    }
}
